{% extends 'generic/object.html' %}
{% load helpers %}
{% load plugins %}
{% load render_table from django_tables2 %}
{% load i18n %}

{% block content %}
<div class="row mb-3">
	<div class="col col-12 col-md-6">
    <div class="card">
      <h2 class="card-header">{% trans "L2VPN Attributes" %}</h2>
      <table class="table table-hover attr-table">
        <tr>
          <th scope="row">{% trans "Name" %}</th>
          <td>{{ object.name|placeholder }}</td>
        </tr>
        <tr>
          <th scope="row">{% trans "Identifier" %}</th>
          <td>{{ object.identifier|placeholder }}</td>
        </tr>
        <tr>
          <th scope="row">{% trans "Type" %}</th>
          <td>{{ object.get_type_display }}</td>
        </tr>
        <tr>
          <th scope="row">{% trans "Status" %}</th>
          <td>{% badge object.get_status_display bg_color=object.get_status_color %}</td>
        </tr>
        <tr>
          <th scope="row">{% trans "Description" %}</th>
          <td>{{ object.description|placeholder }}</td>
        </tr>
        <tr>
          <th scope="row">{% trans "Tenant" %}</th>
          <td>{{ object.tenant|linkify|placeholder }}</td>
        </tr>
      </table>
    </div>
    {% include 'inc/panels/tags.html' with tags=object.tags.all url='vpn:l2vpn_list' %}
    {% plugin_left_page object %}
	</div>
	<div class="col col-12 col-md-6">
      {% include 'inc/panels/custom_fields.html' %}
      {% include 'inc/panels/comments.html' %}
      {% plugin_right_page object %}
    </div>
</div>
<div class="row mb-3">
	<div class="col col-12 col-md-6">
    {% include 'inc/panel_table.html' with table=import_targets_table heading="Import Route Targets" %}
  </div>
	<div class="col col-12 col-md-6">
    {% include 'inc/panel_table.html' with table=export_targets_table heading="Export Route Targets" %}
  </div>
</div>
<div class="row mb-3">
	<div class="col col-md-12">
    <div class="card">
      <h2 class="card-header">
        {% trans "Terminations" %}
        {% if perms.vpn.add_l2vpntermination %}
          <div class="card-actions">
            <a href="{% url 'vpn:l2vpntermination_add' %}?l2vpn={{ object.pk }}&return_url={{ object.get_absolute_url }}" class="btn btn-ghost-primary btn-sm{% if not object.can_add_termination %} disabled" aria-disabled="true{% endif %}">
              <i class="mdi mdi-plus-thick" aria-hidden="true"></i> {% trans "Add a Termination" %}
            </a>
          </div>
        {% endif %}
      </h2>
      {% htmx_table 'vpn:l2vpntermination_list' l2vpn_id=object.pk %}
    </div>
  </div>
</div>
<div class="row mb-3">
  <div class="col col-md-12">
    {% plugin_full_width_page object %}
  </div>
</div>
{% endblock %}
